home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
utility
/
tsbat50.zip
/
WEEKLY.BAT
< prev
next >
Wrap
DOS Batch File
|
1992-09-20
|
2KB
|
72 lines
@echo off
echo.
echo ┌───────────────────────────────────────────────────┐
echo │ Run an application once a week at boot time │
echo │ By Prof. Timo Salmi, ts@uwasa.fi, Sun 20-Sep-1992 │
echo └───────────────────────────────────────────────────┘
if "%2"=="" goto _help
rem Check the weekday syntax
set found_=
for %%d in (Sun Mon Tue Wed Thu Fri Sat) do if "%1"=="%%d" set found_=yes
if "%found_%"=="yes" goto _getday
echo Error in the first parameter %1
echo The valid weekdays are Sun Mon Tue Wed Thu Fri Sat
goto _out
rem Get the weekday into an environment variable
:_getday
echo.| date | find "Current" > tmp$$$.bat
echo set weekday_=%%3> current.bat
call tmp$$$
if exist tmp$$$.bat del tmp$$$.bat
if exist current.bat del current.bat
rem Are we at the target weekday
if "%weekday_%"=="%1" goto _compare
echo It is not %1 today
goto _out
rem Check when this batch was last run
:_compare
if not exist last%1.$$$ goto _doit
echo.|date> datenow.$$$
fc datenow.$$$ last%1.$$$ > tmp$$$
del datenow.$$$
type tmp$$$ | find "no differences encountered" > same$$$
del tmp$$$
copy same$$$ dont$$$ > nul
del same$$$
if not exist dont$$$ goto _doit
del dont$$$
echo WEEKLY.BAT already run today on %1
goto _out
rem Call the application
:_doit
call %2 %3 %4 %5 %6 %7 %8 %9
echo.|date> last%1.$$$
goto _out
:_help
echo.
echo If you want to run a program once a week when you reboot your
echo computer, put
echo CALL WEEKLY Weekday YourApplicationName [Param1] [Param2] [...]
echo in your autoexec.bat file.
echo.
echo Only one application, or one set of applications, can be run on the
echo same weekday with this batch. The application can be a different one
echo for each weekday.
echo.
echo Examples:
echo CALL WEEKLY Mon YourApplication
echo CALL WEEKLY Tue echo Time to back up^G^G^G
echo CALL WEEKLY Fri call YourBatchOfManyPrograms
echo.
:_out
set weekday_=
set found=